{extend name="public:base" /}

{block name="body"}

{include file="channel/_bread" title="附件列表" /}

<div id="page-wrapper" class="container-fluid">

    <div class="row list-header">
        <div class="col-6">
            <a href="{:url('channel/index',['channel_id'=>$channel_id])}" class="btn btn-outline-primary btn-sm"><i
                    class="ion-md-arrow-back"></i> 返回列表</a>
            <a href="{:url('channel/attachmentadd',array('channel_id'=>$channel_id,'aid'=>$aid))}"
                class="btn btn-outline-primary btn-sm upload-attach"><i class="ion-md-add"></i> 添加附件</a>
        </div>
        <div class="col-6">
            <form action="{:url('channel/attachmentlist',['channel_id'=>$channel_id])}" method="post">
                <div class="input-group input-group-sm">
                    <input type="text" class="form-control" name="key" placeholder="输入标题或者地址关键词搜索">
                    <div class="input-group-append">
                        <button class="btn btn-outline-secondary" type="submit"><i class="ion-md-search"></i></button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="row">
        <table class="table table-hover table-striped">
            <thead>
                <tr>
                    <th width="50">编号</th>
                    <th>标题</th>
                    <th>地址</th>
                    <th>说明</th>
                    <th>上传时间</th>
                    <th width="160">&nbsp;</th>
                </tr>
            </thead>
            <tbody>
                {empty name="lists"}{:list_empty(6,'还没有上传附件哦~')}{/empty}
                {foreach $lists as $key=>$v}
                <tr>
                    <td>{$v.id}</td>
                    <td>
                        {$v.title|default='无标题'}
                    </td>
                    <td width="200">
                        <span class="figure-caption text-center" title="{$v.url}" style="width: 100%;overflow:hidden;text-overflow: ellipsis;">{$v.url}</span>
                    </td>
                    <td>
                        {$v.description|default='暂无说明'}
                    </td>
                    <td>
                        {$v.create_time|showdate}
                    </td>
                    <td class="operations">
                        <a class="btn btn-outline-primary upload-attach" title="编辑"
                            href="{:url('channel/attachmentupdate',array('channel_id'=>$channel_id,'id'=>$v['id'],'aid'=>$aid))}"><i
                                class="ion-md-create"></i> </a>
                        <a class="btn btn-outline-danger link-confirm" title="删除" data-confirm="您真的确定要删除吗？\n删除后将不能恢复!"
                            href="{:url('channel/attachmentdelete',array('id'=>$v['id'],'aid'=>$aid))}"><i
                                class="ion-md-trash"></i> </a>

                    </td>
                </tr>
                {/foreach}
            </tbody>
        </table>
        <div class="clearfix"></div>
        {$page|raw}
    </div>
</div>
{/block}